﻿namespace MovieTracker.Catalog
{
    using System;
    using System.Collections.ObjectModel;
    using System.ComponentModel.Composition;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;

    using MovieTracker.Common.Contracts.Catalog;
    using MovieTracker.Common.NetFlixService;

    using Refract.MVVM;

    public class LookupHelper : Component
    {
        #region Fields

        private ObservableCollection<Genre> _genreList;

        #endregion Fields

        #region Constructors

        public LookupHelper()
        {
            if (IsInDesignMode) return;
            CompositionInitializer.SatisfyImports(this);
            GenreService.EntityListLoadComplete += GenreService_EntityListLoadComplete;
            GenreService.GetList();
        }

        #endregion Constructors

        #region Properties

        public ObservableCollection<Genre> GenreList
        {
            get { return _genreList; }
            set { _genreList = value; RaisePropertyChanged(new{GenreList});}
        }

        [Import]
        public IGenreService GenreService
        {
            get; set;
        }

        #endregion Properties

        #region Methods

        void GenreService_EntityListLoadComplete(object sender, Refract.Event.EventArgs<GenreList> e)
        {
            GenreList = e.Parameter;
        }

        #endregion Methods
    }
}